# -*- coding: utf-8 -*-
# Create your views here.
from django.http.response import HttpResponse
from django.template import loader
from django.template.context import Context
from autojump.common import paramFromRequest
from autojump.foo.models import Info
from autojump.foo.service import addInfo, getInfo

def index(request):
    template = loader.get_template('foo/index.html')
    context = Context({})
    return HttpResponse(template.render(context))

def get(request,uid,cid):
    ret = getInfo(int(uid),int(cid))
    return HttpResponse(str(ret.count()))

def add(request):
    id = addInfo(Info(uid=50004207,cid=18942388,subCid=18942388,alias='mjx',default=True))
    return HttpResponse(id)